
import axios from "axios"
// Vue.use(axios)

axios.defaults.baseURL = "/api" //跨域模式
//axios.defaults.baseURL = "http://127.0.0.1:3000/api" //不跨越模式

axios.interceptors.request.use(
    function(request){
        const storage=JSON.parse(localStorage.getItem('loginData'||'{}'))
        if(storage){
            request.headers.Authorization=storage.token
        }
        return request
    }
)

//请求拦截
axios.interceptors.response.use(
function(response){
    
return response.data // 根据axios接口惯例，过滤多余的内容
}
)



export default axios